using UnityEngine;
using System.Collections;
     
public class HighScore : MonoBehaviour 
{	
	public ScoreKeeper scoreKeeper;
	public int lableX = 66;
	public int lableY = 88;
	public int lableZ = 113;
	public int lableW = 20;
	public int savedScore = 0;
	public string userName;	
	public AudioSource buttonPress;
	
	// Use this for initialization
	void Start () 
	{
		scoreKeeper = FindObjectOfType(typeof(ScoreKeeper)) as ScoreKeeper;
		
		savedScore = scoreKeeper.score;
		
		if(savedScore == scoreKeeper.score)
		{
			Destroy(scoreKeeper);
		}
	}
	
	// Update is called once per frame
	void Update () 
	{
		
	}
	
	void OnGUI()
	{		
		GUI.Box(new Rect(30, 30, 400, 300),"Boom Doom");
		GUI.Label(new Rect(195, 60, 100, 20), "High Scores");
		
		GUI.Label(new Rect(lableX, lableY, lableZ, lableW), "Player Name");
		GUI.Label(new Rect(lableX+250, lableY, lableZ, lableW), "Player Score");
		GUI.Label(new Rect(lableX+250, lableY+40, lableZ, lableW), " " + savedScore);
		
		userName = GUI.TextField(new Rect(lableX, lableY+40, lableZ, lableW), userName);
			
		if(GUI.Button(new Rect(175, 300, 100, 20), "Main Menu"))
		{
			buttonPress.Play();
			Application.LoadLevel("MainMenu");
		}
	}
}